{include file="common/header.tpl"}
{if $AppUI->id <= 0}
	{include file="index/login.tpl"}  
{else}
	{include file="common/menu.tpl"}
    <div class="rightColumn">
    	<div class="boxContent">
        	<div class="contentItem">
                <div class="contentItems">
                	<div class="headerTitle"><h2><a href="{$smarty.const.HOST_BACKEND}index/list">Thành viên Ban Quản Trị</a> &raquo; Phân quyền thành viên {$arrInfo->username}</h2></div>
                    <div class="secData">
                    	<form id="frmPermission" name="frmPermission" method="post" action="{$smarty.const.HOST_BACKEND}index/saveperm" enctype="multipart/form-data">
                        	<input type="hidden" name="padminid" id="padminid" value="{$arrInfo->id}" />
                            <input type="hidden" name="pusername" id="pusername" value="{$arrInfo->username}" />
                        	{if $arrAPerm}
                                <div class="secActionAndPage">
                                    <div class="actionLink">
                                    	{if isset($smarty.session.admin)}
                                            {if ($smarty.session.admin&1<<2) > 0}  
                                                <input type="button" value="Lưu phân quyền" class="btnLarge" onclick="javascript:savePermission(this.form)"/>
                                            {/if}
                                       	{else}
                                        	&nbsp;
                                        {/if}
                                    </div>
                                </div>
                            {/if}
                            <table width="100%" cellpadding="0" cellspacing="0" border="0">
                                <thead>
                                    <tr>
                                        <th>Loại danh mục</th>
                                        <th width="80%">Phân quyền</th>
                                    </tr>
                                </thead>
                                <tbody>
                                	{if $arrAPerm}
                                        {foreach item=item from=$arrAPerm}
	                                        <tr class="{cycle values="odd,even"}">
                                            	<td><label for="pPerm6_{$item.sectionid}" style="width:100%;">{$item.name}</label></td>
                                                <td>
                                                	<div class="chkPerm">
                                                    	<!--check all-->
                                                        <input type="checkbox" id="pPerm6_{$item.sectionid}" class="chkPerm" onclick="javascript:checkAllPerm(this,'{$item.sectionid}')" {if (($item.perm&1<<0)>0) && (($item.perm&1<<1)>0) && (($item.perm&1<<2)>0) && (($item.perm&1<<3)>0) && (($item.perm&1<<4)>0) && (($item.perm&1<<5)>0)}checked="checked"{/if}/>
                                                        <label for="pPerm6_{$item.sectionid}" class="chkPerm">Tất cả</label>
                                                    </div>
                                                    <div class="chkPerm">
                                                        <input type="checkbox" name="pPerm{$item.sectionid}[]" id="pPerm0_{$item.sectionid}" value="{pow x=2 y=0}" class="chkPerm" onclick="javascript:uncheckAllPerm(this,'{$item.sectionid}')" {if ($item.perm&1<<0)>0}checked="checked"{/if}/>
                                                        <label for="pPerm0_{$item.sectionid}" class="chkPerm">Chỉ được xem</label>
                                                   	</div>
                                                    <div class="chkPerm">
                                                        <!--them moi-->
                                                        <input type="checkbox" name="pPerm{$item.sectionid}[]" id="pPerm1_{$item.sectionid}" value="{pow x=2 y=1}" class="chkPerm" onclick="javascript:uncheckAllPerm(this,'{$item.sectionid}')" {if ($item.perm&1<<1)>0}checked="checked"{/if}/>
                                                        <label for="pPerm1_{$item.sectionid}" class="chkPerm">Thêm mới</label>
                                                   	</div>
                                                    <div class="chkPerm">
                                                        <!--cap nhat-->
                                                        <input type="checkbox" name="pPerm{$item.sectionid}[]" id="pPerm2_{$item.sectionid}" value="{pow x=2 y=2}" class="chkPerm" onclick="javascript:uncheckAllPerm(this,'{$item.sectionid}')" {if ($item.perm&1<<2)>0}checked="checked"{/if}/>
                                                        <label for="pPerm2_{$item.sectionid}" class="chkPerm">Cập nhật</label>
                                                   	</div>
                                                    <div class="chkPerm">
                                                        <!--xoa-->
                                                        <input type="checkbox" name="pPerm{$item.sectionid}[]" id="pPerm3_{$item.sectionid}" value="{pow x=2 y=3}" class="chkPerm" onclick="javascript:uncheckAllPerm(this,'{$item.sectionid}')" {if ($item.perm&1<<3)>0}checked="checked"{/if}/>
                                                        <label for="pPerm3_{$item.sectionid}" class="chkPerm">Xóa</label>
                                                   	</div>
                                                    <div class="chkPerm">
                                                        <!--tam dung-->
                                                        <input type="checkbox" name="pPerm{$item.sectionid}[]" id="pPerm4_{$item.sectionid}" value="{pow x=2 y=4}" class="chkPerm" onclick="javascript:uncheckAllPerm(this,'{$item.sectionid}')" {if ($item.perm&1<<4)>0}checked="checked"{/if}/>
                                                        <label for="pPerm4_{$item.sectionid}" class="chkPerm">Tạm dừng</label>
                                                   	</div>
                                                    <div class="chkPerm">
                                                        <!--kich hoat/phuc hoi-->
                                                        <input type="checkbox" name="pPerm{$item.sectionid}[]" id="pPerm5_{$item.sectionid}" value="{pow x=2 y=5}" class="chkPerm" onclick="javascript:uncheckAllPerm(this,'{$item.sectionid}')" {if ($item.perm&1<<5)>0}checked="checked"{/if}/>
                                                        <label for="pPerm5_{$item.sectionid}" class="chkPerm">Kích hoạt / phục hồi</label>
                                                   	</div>
                                                </td>
                                            </tr>
                                        {/foreach}
                                   	{/if}
                                </tbody>
                            </table>
                            {if $arrAPerm}
                                <div class="secActionAndPage">
                                    <div class="actionLink">
                                    	{if isset($smarty.session.admin)}
                                            {if ($smarty.session.admin&1<<2) > 0}  
                                                <input type="button" value="Lưu phân quyền" class="btnLarge" onclick="javascript:savePermission(this.form)"/>
                                            {/if}
                                       	{else}
                                        	&nbsp;
                                        {/if}
                                    </div>
                                </div>
                            {/if}
                      	</form>
                   	</div>
                </div>
          	</div>
        </div>
    </div>
{/if}
{include file="common/footer.tpl"}
                
